import numpy as np
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt

x_data = np.loadtxt('dataset.csv', dtype=np.float_, delimiter=',')
y_data = np.loadtxt('y_data.csv', dtype=np.float_, delimiter=',')
x = np.array(x_data)
y = np.array(y_data)

from sklearn.model_selection import train_test_split
from sklearn import datasets

boston = datasets.load_boston()

X = boston.data
y = boston.target
X = X[y < 50.0]
y = y[y < 50.0]

X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=666)

reg = LinearRegression()
reg.fit(X_train, y_train)

print(reg.coef_)
print(reg.intercept_)
print(reg.score(X_test, y_test))
